function EventDispatcher()
{
	this.handlers = [];
}

// Triggers the event specified by the name and passes the eventArgs to listeners
EventDispatcher.prototype.trigger = function(eventArgs)
{
	for(var i = 0; i < this.handlers.length; i++)
		//this.handlers[i].eventHandler.call(this.handlers[i].obj, eventArgs);
		this.handlers[i].eventHandler(eventArgs);
}

// Adds a listener/subscriber to the event specified by the 'name' parameter
EventDispatcher.prototype.addListener = function(obj, handler)
{
	if(typeof(handler) != 'function')
	{
		throw new SyntaxError("Invalid parameters when creating listener with the following arguments: 'Handler': " + handler);
	}

	this.handlers.push({ "caller" : obj, "eventHandler" : handler });
}

EventDispatcher.prototype.toString = function()
{
  return "[EventDispatcher]";
}